﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <script src="~/js/easyui/jquery.min.js"></script>
    <script src="~/js/easyui/jquery.easyui.min.js"></script>
    <script src="~/js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <link href="~/js/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/js/easyui/themes/icon.css" rel="stylesheet" />
    <script type="text/javascript">
        document.onkeydown = function (event) {
            var e = event ? event : (window.event ? window.event : null);
            if (e.keyCode == 13) {
                dologin();
            }
        }
        $(function () {
            $("#validCodeImg").bind("click", function () {
                this.src = "/Login/ValidateCode?time=" + (new Date()).getTime();
            });
        });

        function dologin() {
            var logname = $("#logname").textbox('getValue');
            if (logname == "") {
                $.messager.alert("提示消息", "请填写登录帐号");
                return;
            }
            var logpass = $("#logpass").passwordbox('getValue');
            if (logpass == "") {
                $.messager.alert("提示消息", "请填写登录密码");
                return;
            }
            var logcode = $("#logcode").textbox('getValue');
            if (logcode == "") {
                $.messager.alert("提示消息", "请填写验证码");
                return;
            }
            $.ajax({
                url: "/Login/LoginIn",
                type: 'post',
                data: {
                    logname: logname,
                    logpass: logpass,
                    logcode: logcode
                },
                dataTye: 'json',
                success: function (data) {
                    if (data.IsOK) {
                        location.href = "/Home/Index";
                    }
                    else {
                        $.messager.alert("提示消息", data.Message);
                    }
                }
            });
        }
    </script>
</head>
<body>
    <div id="win" class="easyui-window" title="请先登录" data-options="modal:true,iconCls:'icon-lock',closable:false,minimizable:false" style="width:400px;padding:20px 60px 20px 60px;">
        <div style="margin-bottom:10px">
            <input class="easyui-textbox" id="logname" style="width:100%;height:30px;padding:12px" data-options="prompt:'登录帐号',iconCls:'icon-man',iconWidth:38">
        </div>
        <div style="margin-bottom:20px">
            <input id="logpass" class="easyui-passwordbox" style="width:100%;height:30px;padding:12px" data-options="prompt:'登录密码',iconWidth:38">
        </div>
        <div style="margin-bottom:20px">
            <input class="easyui-textbox" type="text" id="logcode" style="width:60%;height:30px;padding:12px" data-options="prompt:'验证码'">
            <img id="validCodeImg" style="margin:0 0 0 3px; vertical-align:middle; height:28px; cursor:pointer;" src="/Login/ValidateCode">
        </div>
        <div>
            <a href="javascript:;" onclick="dologin()" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="padding:5px 0px;width:100%;">
                <span style="font-size:14px;">登录</span>
            </a>
        </div>
    </div>
</body>
</html>